home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '93 / Papers '93 / Macintosh as Internet Server ƒ / inetd / Libraries / myUtils / myUtils.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-17  |  969 b   |  71 lines  |  [TEXT/MPS ]

  1.  
  2. #include "MyUtils.h"
  3.  
  4. #ifndef __PACKAGES__
  5. #include <Packages.h>
  6. #endif
  7. #ifndef __STDARG__
  8. #include <StdArg.h>
  9. #endif
  10. #ifndef __STDIO__
  11. #include <StdIO.h>
  12. #endif
  13. #ifndef __STRINGS__
  14. #include <Strings.h>
  15. #endif
  16.  
  17. void
  18. BlockSet(void* ptr, long len, char what)
  19. {
  20.     while (len--)
  21.         *((char*) ptr)++ = what;
  22. }
  23.  
  24. OSErr
  25. DebugIfErr(OSErr theErr)
  26. {
  27.     if (theErr != noErr) {
  28.         Str255    pstr;
  29.         
  30.         NumToString((long) theErr, pstr);
  31.         DebugStr(pstr);
  32.     }
  33.     
  34.     return theErr;
  35. }
  36.  
  37. void
  38. PStrCat(Str255 base, Str255 append)
  39. {
  40.     int    lenBase = Length(base);
  41.     int    lenAppend = Length(append);
  42.     int    j;
  43.     
  44.     for (j = 1; j <= lenAppend; j++) {
  45.         base[lenBase + j] = append[j];
  46.     }
  47.     
  48.     base[0] = lenBase + lenAppend;
  49. }
  50.  
  51. void
  52. MBPrintf(char* form, ...)
  53. {
  54.     va_list ap;
  55.     char    str[256];
  56.     
  57.     va_start(ap, form);
  58.     vsprintf(str, form, ap);
  59.     va_end(ap);
  60.     
  61.     DebugStr(c2pstr(str));
  62. }
  63.  
  64. Boolean
  65. SameProcesses(ProcessSerialNumber* p1, ProcessSerialNumber* p2)
  66. {
  67.     Boolean same;
  68.     SameProcess(p1, p2, &same);
  69.     return same;
  70. }
  71.